<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>我的信息列表</title>
<style type="text/css">
	*{
		margin: 0px;
		padding: 0px;
	}
	#div_boss{
		width: 1920px;
		height: 1080px;
		background:url("/bbs/img/login_bg.png");
		position: absolute;
	}
	#head_div{
		width: 550px;
		height: 30px;
		font-size:23px;
		position: absolute;
		margin-top: 50px;
		margin-left: 1200px;
	}
	#head_div1{
		width:100px;
		height: 30px;
		text-align: center;
		position: absolute;
		margin-left: 0px;
		
	}
	#head_div2{
		width:200px;
		height: 30px;
		font-size:20px;
		text-align: center;
		position: absolute;
		margin-left: 100px;
	}
	#head_div3{
		width:100px;
		height: 30px;
		text-align: center;
		position: absolute;
		margin-left: 300px;
	}
	#head_div4{
		width:150px;
		height: 30px;
		text-align: center;
		position: absolute;
		margin-left: 400px;
	}
	.head_span:hover{
		cursor: pointer;
		font-size:25px;
		color: cornflowerblue;
	}
	#myMsg{
		width: 310px;
		height: 70px;
		font-family: Microsoft YaHei UI, Microsoft YaHei UI-Bold;
		font-weight: 600;
		font-size:50px;
		position: absolute;
		margin-left: 100px;
		margin-top: 150px;
	}
	#myMsglist_boss{
		width:600px;
		height:800px;
		margin-left: 100px;
		margin-top: 220px;
		position: absolute;
	}
	.myMsglist{
		width:600px;
		height: 30px;
		opacity: 0.7;
		background-color:#EEEEEE;
		border-radius: 3px 3px 3px 3px;
		border-right:3px solid #A9A9A9;
		border-bottom:3px solid #A9A9A9;
		margin-top: 10px;
	}
	.myMsglist:hover{
		cursor: pointer;
		background-color:lightcyan;
	}
	.envelope{
		margin-top:4px;
		margin-left:30px;
		width: 25px;
		height: 22px;
		position: absolute;
	}
	.envelope_img{
		width: 25px;
	}
	.sendUname{
		color:cornflowerblue;
		margin-top: 3px;
		margin-left: 70px;
		position: absolute;
	}
	.note{
		width:120px;
		color:cornflowerblue;
		margin-top: 3px;
		margin-left: 130px;
		position: absolute;
		overflow: hidden;
      	white-space:nowrap;
      	text-overflow:ellipsis;
	}
</style>
<script type="text/javascript" src="/bbs/js/jquery-1.11.2.min.js"></script>
<script type="text/javascript">
	/*页面加载完成时事件*/
	$(function(){
		//获取用户登录信息
		getUser();
		//初始化信息列表
		showMesslist();
	})
	function getUser(){
		$.post("getUser.json",{"opt":"selectUser"},function(data){
			$("span:eq(0)").html(data.uname);
		},"json");
	}
	function showMesslist(){
		$.post("showMesslist.mess",{"opt":"showMesslist"},function(data){
			var messlist = "";
			for(var i in data){
				console.log(data);
				if(data[i].readSign==0){
					messlist+="<div class='myMsglist' onclick='showMsg("+data[i].id+")'><div class='envelope'><img src='/bbs/img/new.jpg' class='envelope_img'></div> <div class='sendUname'>["+data[i].sendUname+"]：</div> <div class='note'>"+data[i].note+"</div></div>";
					
				}else if(data[i].readSign==1){
					messlist+="<div class='myMsglist' onclick='showMsg("+data[i].id+")'><div class='envelope'><img src='/bbs/img/old.jpg' class='envelope_img'></div> <div class='sendUname'>["+data[i].sendUname+"]：</div> <div class='note'>"+data[i].note+"</div></div>";
				}
				$("div:eq(7)").html(messlist);
			}
		},"json");
	}
	function showMsg(msgId) {
		$.get("addMsgId.mess",{"opt":"addMsgId","msgId":msgId},function(){
		},"json")
		console.log(msgId);
		location.href = "/bbs/login_succ/showMsg.html";
	}
	function exit() {
		$.post("exit.json",{"opt":"exit"},function(data){
			location.href = "/bbs/index.html";
		},"text");
	}
	function sendMsg() {
		location.href = "/bbs/login_succ/sendMsg.html";
	}
</script>
</head>
<body>
	<div id="div_boss">
		<div id="head_div">
			<div id="head_div1">当前用户</div>
			<div id="head_div2"><span></span></div>
			<div id="head_div3"><span class="head_span" onclick="exit()">[登出]</span></div>
			<div id="head_div4"><span class="head_span" onclick="sendMsg()">[发送消息]</span></div>
		</div>
		<div id="myMsg">我&nbsp;的&nbsp;短&nbsp;信&nbsp;息</div>
		<div id="myMsglist_boss"></div>
				
	</div>
</body>
</html>